Action: Send a Message to REST Endpoint

In Cloudhouse Guardian (Guardian), you can configure actions to occur after certain events take place. For example, you can configure Guardian to automatically make an API call when an event occurs. Let's say you want to integrate Guardian with an internal system to store a login record of all Guardian users. You can do that using a REST endpoint action which makes an API call to your internal system each time a user logs in to Guardian.

Note: The following process assumes you have a REST endpoint already configured in Guardian. For more information, see REST Endpoint Integration.

Screenshot showing the Add Action page for sending a message to a REST Endpoint in Guardian.

Tip: For an overview of actions in Guardian, including more options available to choose from, see Actions.

Action Settings

When configuring a Send a Message to a REST Endpoint action, the following settings are presented:

Setting Description
Action Name field A unique name for the action. This name is how you will identify this action among all others configured in your Guardian instance, so ensure it is descriptive. For example, 'User Login API Call' and not simply 'User Login'.
REST Endpoint Integration drop-down list

A list of all REST endpoint integrations configured in your Guardian instance.

When configuring a REST endpoint integration, you provide the endpoint URL, authentication credentials, and request method. From the drop-down list, select the REST endpoint you want to use for this action.

Body field

The request body to send to your chosen REST endpoint. What you include in your request body depends on what is required by the endpoint you're communicating with. Consult the external API's documentation to determine what needs to be included. Then, write the body of the REST call in JSON format as in the following example:

Copy
{
    "user_id": "{{ user_id }}"
    "time": "{{ timestamp }}"
}

The above example also makes use of variables. In Guardian, variables are pieces of text that are replaced with data relevant to a specific event. For example, {{ user_id }} in the above request body will be replaced with the actual ID of the user logging in to Guardian at the time the action is triggered. Similarly, {{ timestamp }} will be replaced with the time the login occurred. Using variables can make your API calls dynamic and ensure relevant information is sent in your request.

These settings are configured when adding a new action, and they can also be edited at any time through the Actions tab (ControlEvents > Action). To edit an action from the Actions tab, click the Ellipses () and select Edit. Once you have made your edits, click Done to save them.

Add a Send a Message to REST Endpoint Action

You can add a new Send a Message to REST Endpoint action from any saved view in your Guardian instance. Each saved view represents a specific event determined using a query on the Events page. The saved view you select during this configuration determines the corresponding event that triggers your new action. For more information, see Saved Views.

To add a Send a Message to REST Endpoint action, complete the following process:

Tip: For help completing any of the following fields, refer to their respective descriptions in the Action Settings table above.

  1. Navigate to the Events tab (Control Events).

  2. Click the Saved Views button at the top of the page. The Saved Views side panel is displayed.

    Screenshot showing the Guardian Events page with a border around the Saved Views button.

  3. Select the event you want to trigger your new action. The saved view for that event is displayed.

  4. Click the Actions tab to display all existing actions configured for this event.

  5. Click the Add Action button. The Add New Action page is displayed.

    Screenshot showing the Guardian Events page with a border around the Actinos tab and the Add Action button.

  6. Click Send a Message to REST Endpoint. The required fields are displayed.

  7. Enter an Action Name.

  8. Select an integration from the REST Endpoint Integration drop-down.

  9. Enter a Body.

  10. Click Done.

Now, a confirmation dialog is displayed and you are redirected to the Actions tab for your selected saved view. Here, you can view your new action. To disable, edit, or test the action, click the Ellipses () and select the appropriate option.